﻿using System.Security.Principal;

namespace Sidvall.Security
{
    public class PrincipalProvider : Sidvall.Security.IPrincipalProvider
    {
        #region Public Members

        #region CurrentPrincipal

        public IPrincipal CurrentPrincipal
        {
            get
            {
                return System.Threading.Thread.CurrentPrincipal;
            }
            set
            {
                System.Threading.Thread.CurrentPrincipal = value;
            }
        }

        #endregion

        #region SetThreadPrincipal

        public void SetThreadPrincipal(IPrincipal principal)
        {
            System.AppDomain.CurrentDomain.SetThreadPrincipal(principal);
        }

        #endregion
        #region ToString

        public override string ToString()
        {
            return "PrincipalProvider - Thread.CurrentPrincipal";
        }

        #endregion

        #endregion
    }
}
